﻿///***************************************************************
/// 시  스  템 : Updms.Crd.Dac
/// 단위시스템 : CRD
/// 계      층 : Data Access Layer
/// 프로그램명 : Crd_Dac_UPDMS_CRD_INFO
/// 파  일  명 : Crd_Dac_UPDMS_CRD_INFO.cs
/// 설      명 : 카드기본정보
///***************************************************************
/// 수정ID 일자       이름     내용
///---------------------------------------------------------------
/// CH001  2008-07-16 송시명   최초 작성
///***************************************************************
using System.Data;
using System.Data.SqlClient;
using System.EnterpriseServices;
using System.Runtime.InteropServices;

using SMFramework.Data;


namespace Updms.Crd.Dac
{
	[ComVisible(true)]
	[Transaction(TransactionOption.Supported)]
	[JustInTimeActivation(true)]
	public class Crd_Dac_UPDMS_CRD_INFO : Base.AppFramework.DacBase
	{
		public Crd_Dac_UPDMS_CRD_INFO()
		{
		}

		#region NT [GetSearchCount]
		
		[AutoComplete]
		public int GetSearchCount(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_CRD_INFO_Get_Search_Count";
			
			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			
			return (int)_agent.ExecuteScalar(ls_sql, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region NT [SelectProcess]
		
		[AutoComplete]
		public DataSet SelectProcess(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_CRD_INFO_Select_Paging";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(ls_sql, "UPDMS_CRD_INFO", ds, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region NT [GetNewCardCd]

		[AutoComplete]
		public string GetNewCardCd()
		{
			string ls_sql = "usp_UPDMS_CRD_INFO_Get_New_Card_Cd";

			return (string)_agent.ExecuteScalar(ls_sql, null, CommandType.StoredProcedure);
		}

		#endregion

		#region NT [GetCardInfoList]
		/// <summary>
		/// 등록된 카드정보 조회(Y : 사용여부가 Y인것, N : 사용여부가 N인것, 나머지는 전체조회)
		/// </summary>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetCardInfoList(string ls_regi_yn)
		{
			string ls_sql = "usp_UPDMS_CRD_INFO_Get_Card_Info_List";

			SqlParameter[] paramArray =
			{
				new SqlParameter("ls_regi_yn", ls_regi_yn)
			};

			DataSet ds = new DataSet();
			return _agent.Fill(ls_sql, "UPDMS_CRD_INFO", ds, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion	

		#region NT [GetCardInfoListByYearly]
		/// <summary>
		/// 연도별 사용내역이 있는 카드의 목록
		/// </summary>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetCardInfoListByYearly(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_CRD_INFO_Get_Card_Info_List_By_Yearly";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(ls_sql, "UPDMS_CRD_INFO", ds, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region NT [GetPaymntDtRegion]
		/// <summary>
		/// 카드별 결제일 범위 조회 - Crd1011m(카드결제일관리)에서 사용
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetPaymntDtRegion(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_CRD_INFO_Get_Paymnt_Dt_Region";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(strSql, "UPDMS_CRD_INFO", ds, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region NT [GetCardInfo]
		/// <summary>
		/// 카드코드로 카드정보조회
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetCardInfo(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_CRD_INFO_Get_Card_Info";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(ls_sql, "UPDMS_CRD_INFO", ds, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region NT [GetCardUsedLocationMarkers]
		/// <summary>
		/// 카드사용장소
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetCardUsedLocationMarkers(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_CRD_INFO_Get_Card_Used_Location_Markers";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(ls_sql, "UPDMS_CRD_INFO", ds, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region NT [GetContentsList]
		/// <summary>
		/// 모든 카드의 내용리스트 조회
		/// </summary>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetContentsList()
		{
			string ls_sql = "usp_UPDMS_CRD_Get_Contents_List";

			DataSet ds = new DataSet();
			return _agent.Fill(ls_sql, "UPDMS_CRD_CONTENTS", ds, null, CommandType.StoredProcedure);
		}

		#endregion
		
		

		#region RT [Insert]
		
		[AutoComplete]
		public int Insert(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_CRD_INFO_Insert";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(ls_sql, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region RT [Update]
		
		[AutoComplete]
		public int Update(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_CRD_INFO_Update";		
			
			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(ls_sql, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region RT [Delete]
		
		[AutoComplete]
		public int Delete(string ls_xml)
		{
			string ls_sql = "usp_UPDMS_CRD_INFO_Delete";

			SqlParameter[] paramArray =
			{
				new SqlParameter("ls_xml", ls_xml)
			};
			
			return _agent.ExecuteNonQuery(ls_sql, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region RT [DeleteAttachFile]

		[AutoComplete]
		public int DeleteAttachFile(string ls_seq, int li_file_idx)
		{
			string strSql = "usp_UPDMS_CRD_INFO_Delete_Attach_File";

			SqlParameter[] paramArray =
			{
				new SqlParameter("Seq", ls_seq),
				new SqlParameter("li_file_idx", li_file_idx)
			};

			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}

		#endregion
	}
}
